﻿<Controls:SinacorWindow x:Class="Sinacor.UI.Bovespa.Ordens.View.SmartClient.OrdensMegaBolsa"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="{DynamicResource Bovespa.Ordens.Label.AbertasOfertaMegaBolsa}"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Validation="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Validation;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Edit="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Edit;assembly=Sinacor.Infra.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    ModuleId="ORD" ModulePlus="false" Closing="OrdensMegaBolsa_Closing" WindowState="Maximized">
    <Controls:SinacorExpanderContainer x:Name="OrdemMegaBolsa">
        <Controls:SinacorExpanderContainer.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" MinHeight="200"  />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="100" MinHeight="100" />
        </Controls:SinacorExpanderContainer.RowDefinitions>
        <Controls:SinacorExpander  Grid.Row="0" x:Name="exp1" Header="{DynamicResource Bovespa.Ordens.Label.Pesquisar}" IsExpanded="True">
            <Grid x:Name="grdFiltro" DockPanel.Dock="Top">

                <Controls:SinacorButton x:Name="btnBusca" OnBufferedClick="btnBusca_OnBufferedClick"  Content="{DynamicResource Bovespa.Ordens.Label.Pesquisar}" Margin="715,69,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="104" d:LayoutOverrides="VerticalAlignment" TabIndex="14" IsDefault="True"/>
                <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Pregao}" HorizontalAlignment="Left" VerticalAlignment="Top" x:Name="labelPregao" VerticalContentAlignment="Bottom" Width="90.536" HorizontalContentAlignment="Left"/>
                <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Ordem}" x:Name="labelOrdem" VerticalAlignment="Top" Width="86" VerticalContentAlignment="Bottom" HorizontalContentAlignment="Left" Margin="94,0,0,0" HorizontalAlignment="Left" d:LayoutOverrides="Height"/>
                <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Apelido}" HorizontalAlignment="Left" x:Name="labelApelido" VerticalAlignment="Top" Width="128" VerticalContentAlignment="Bottom" HorizontalContentAlignment="Left" Margin="184,0,0,0"/>
                <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Papel}" x:Name="labelPapel" VerticalAlignment="Top" VerticalContentAlignment="Bottom" HorizontalAlignment="Left" Width="88" HorizontalContentAlignment="Left" Margin="316,0,0,0"/>
                <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Operador}" x:Name="labelOperador" VerticalAlignment="Top" HorizontalAlignment="Left" Width="186" VerticalContentAlignment="Bottom" HorizontalContentAlignment="Left" Margin="408,0,0,0"/>
                <Controls:SinacorComboBox IsSynchronizedWithCurrentItem="True"  HorizontalAlignment="Left" Width="90.536" IsRequired="True" x:Name="comboPregao" IsEditable="False" TabIndex="1" VerticalAlignment="Top" Margin="0,21,0,0"/>
                <Controls:SinacorComboBox IsSynchronizedWithCurrentItem="True" x:Name="comboOperador" VerticalAlignment="Top" TabIndex="5" Width="186" IsEditable="False" HorizontalAlignment="Left"  Margin="408,21,0,0"/>
                <Controls:SinacorInt32TextBox IsFormated="True" Text="" Width="86" x:Name="txtOrdem" TabIndex="2" Integers="9" AcceptsNegative="False" VerticalAlignment="Top" Margin="94,21,0,0" HorizontalAlignment="Left" />
                <Controls:SinacorTextBox HorizontalAlignment="Left" Width="128" x:Name="txtApelido" TabIndex="3"  MaxLength="18" d:LayoutOverrides="Height" Margin="184,21,0,0" VerticalAlignment="Top"/>
                <Controls:SinacorTextBox x:Name="txtPapel" HorizontalAlignment="Left" Width="88" TabIndex="4" MaxLength="12" VerticalAlignment="Top" d:LayoutOverrides="Height" Margin="316,21,0,0" />
                <Controls:SinacorCheckBox HorizontalAlignment="Left"  VerticalAlignment="Top" Panel.ZIndex="0" TabIndex="13" x:Name="checkCanceladas" Padding="2,0,0,0" Width="104" Margin="598,69,0,0" Content="{DynamicResource Bovespa.Ordens.Label.Canceladas}"/>
                <Controls:SinacorGroupBox  Header="{DynamicResource Bovespa.Ordens.Label.Natureza}" Margin="0,46,0,0" x:Name="groupNatureza" HorizontalAlignment="Left" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment" Width="594" Height="51"  >
                    <Grid>
                        <Controls:SinacorRadioButton Content="{DynamicResource Bovespa.Ordens.Label.Casadas}" Foreground="{DynamicResource BrushGridRowBusiness01}" x:Name="rdbCasadas" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" TabIndex="9" Margin="93,0,0,0" Padding="2,0,0,0"/>
                        <Controls:SinacorRadioButton Content="{DynamicResource Bovespa.Ordens.Label.Todas}"   Margin="0,0,0,0" x:Name="rdbTodas" HorizontalAlignment="Left" VerticalAlignment="Top" Width="89" TabIndex="8" Padding="2,0,0,0"/>
                        <Controls:SinacorRadioButton Content="{DynamicResource Bovespa.Ordens.Label.Executadas}" Foreground="{DynamicResource BrushGridRowBusiness08}" Margin="426,0,0,0" x:Name="rdbExecutadas" HorizontalAlignment="Left" VerticalAlignment="Top" Width="150" TabIndex="12" Padding="2,0,0,0"/>
                        <Controls:SinacorRadioButton Content="{DynamicResource Bovespa.Ordens.Label.CasadasParte}" Foreground="{DynamicResource BrushGridRowBusiness04}" Margin="307,0,0,0" x:Name="rdbCasadasParte" Width="115" TabIndex="11" Padding="2,0,0,0" d:LayoutOverrides="VerticalAlignment, Height" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                        <Controls:SinacorRadioButton Content="{DynamicResource Bovespa.Ordens.Label.NaoCasadas}" Foreground="{DynamicResource BrushGridRowBusiness06}" Margin="197,0,0,0" x:Name="rdbNaoCasadas" VerticalAlignment="Top" Width="106" TabIndex="10" Padding="2,0,0,0" HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment"/>

                    </Grid>
                </Controls:SinacorGroupBox>
                <Controls:SinacorGroupBox Header="{DynamicResource Bovespa.Ordens.Label.Data}" x:Name="groupDataPregao" FontFamily="Segoe UI" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="598,0,0,0" Height="51" Width="228"  >
                    <Grid>
                        <Controls:SinacorButton VerticalAlignment="Top" Width="105" Margin="109,0,0,0" x:Name="buttonPreBoleto" TabIndex="7" Content="{DynamicResource Bovespa.Ordens.Label.TituloPreBoleto}" HorizontalAlignment="Left"/>
                        <Controls:SinacorDatePicker HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0" x:Name="datapikerPregao" IsHitTestVisible="True" TabIndex="6" />
                    </Grid>
                </Controls:SinacorGroupBox>

            </Grid>
        </Controls:SinacorExpander>

        <Controls:SinacorExpander Header="{DynamicResource Bovespa.Ordens.Label.Ordens}" x:Name="expanderGridOrdens" Grid.Row="1" HorizontalSplitter="{Binding ElementName=horizontalSpliter2}" Margin="0,4,0,0">
            <Controls:SinacorDataGrid x:Name="grdOrdens"
				AllowPanelUpdate="True"
				RowEditMode="EditPanel"
				EndingUpdate="grdOrdens_EndingUpdate"
				ApplyingStyle="grdOrdens_ApplyingStyle"
				ItemsSource="{Binding Path=itensMegabolsa}"
				UpdateEnded="grdOrdens_UpdateEnded"
				SelectionChanged="grdOrdens_SelectionChanged">
                <Controls:SinacorDataGrid.Columns>
                    <Controls:Column Name="DataOrdem" Title="Bovespa.Ordens.Label.DataOrdem" DisplayMemberPath="DataOrdem" HorizontalCellAlignment="Center" />
                    <Controls:Column Name="NomeOperador" Title="Bovespa.Ordens.Label.NomeOperador" DisplayMemberPath="NomeOperador"/>
                    <Controls:Column Name="Numero" Title="Bovespa.Ordens.Label.Numero"  DisplayMemberPath="Numero"  HorizontalCellAlignment="Right" />
                    <Controls:Column Name="NaturezaOperacao" Title="Bovespa.Ordens.Label.NaturezaOperacao" DisplayMemberPath="NaturezaOperacao" />
                    <Controls:Column Name="ApelidoCliente" Title="Bovespa.Ordens.Label.ApelidoCliente" DisplayMemberPath="ApelidoCliente" />
                    <Controls:Column Name="NomeCliente" Title="Bovespa.Ordens.Label.NomeCliente" DisplayMemberPath="NomeCliente" />
                    <Controls:Column Name="Bolsa" Title="Bovespa.Ordens.Label.Bolsa" DisplayMemberPath="Bolsa" />
                    <Controls:Column Name="Mercado" Title="Bovespa.Ordens.Label.Mercado" DisplayMemberPath="Mercado" />
                    <Controls:Column Name="Titulo" Title="Bovespa.Ordens.Label.Titulo" DisplayMemberPath="Titulo" />
                    <Controls:Column Name="Quantidade" Title="Bovespa.Ordens.Label.Quantidade" DisplayMemberPath="Quantidade" Decimals="4" Integers="16"  StringFormat="n4"  HorizontalCellAlignment="Right" />
                    <Controls:Column Name="ContaMae" Title="Bovespa.Ordens.Label.ContaMae" DisplayMemberPath="ContaMae"  HorizontalCellAlignment="Right" />
                    <Controls:Column Name="TipoLiquidacaoOrdem" Title="Bovespa.Ordens.Label.TipoLiquidacaoOrdem" DisplayMemberPath="TipoLiquidacaoOrdem"  />
                    <Controls:Column Name="Carteira" Title="Bovespa.Ordens.Label.Carteira" DisplayMemberPath="Carteira"  HorizontalCellAlignment="Right" />
                    <Controls:Column Name="PercentualReducaoAcrescimo" Title="Bovespa.Ordens.Label.PercentualReducaoAcrescimo" DisplayMemberPath="PercentualReducaoAcrescimo" Decimals="4" Integers="8" StringFormat="n4"  HorizontalCellAlignment="Right" />
                    <Controls:Column Name="DataValidade" Title="Bovespa.Ordens.Label.DataValidade" DisplayMemberPath="DataValidade"   HorizontalCellAlignment="Center"/>
                    <Controls:Column Name="PessoaVinculada" Title="Bovespa.Ordens.Label.PessoaVinculada" DisplayMemberPath="PessoaVinculada" />
                </Controls:SinacorDataGrid.Columns>

                <Controls:SinacorDataGrid.PanelUpdateTemplate>
                    <DataTemplate>
                        <DataTemplate.Resources>
                            <BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
                        </DataTemplate.Resources>
                        <Grid Height="80">
                            <Controls:SinacorLabel Margin="8,0,0,0" Content="{DynamicResource Bovespa.Ordens.Label.Apelido}"   x:Name="labelUpdateApelido" Padding="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="65.98"/>
                            <Controls:SinacorTextBox Text="{Binding Path=ApelidoCliente}" Margin="8,20,0,0" LostFocus="textUpdateApelido_LostFocus" x:Name="textUpdateApelido" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="108" Panel.ZIndex="0" TabIndex="19" MaxLines="1" MaxLength="18"/>
                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.NomeCliente}" Margin="120,0,0,0" x:Name="labelUpdateNomeCliente"  Padding="0,0,0,0"  HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="150"/>
                            <Controls:SinacorTextBox Text="{Binding Path=NomeCliente}" Margin="120,20,0,0" x:Name="textUpdateNomeCliente" Width="230" Panel.ZIndex="0" TabIndex="19" MaxLines="1" HorizontalAlignment="Left"  VerticalAlignment="Top" IsEnabled="False" />

                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.TipoLiquidacaoOrdem}" Margin="355,0,0,0"  x:Name="labelUpdateTipoLiquidacaoOrdem"  Padding="0,0,0,0"  HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="132"/>
                            <Controls:SinacorComboBox SelectedValue="{Binding Path=TipoLiquidacaoOrdem}" Margin="355,20,0,0" x:Name="comboTipoLiquidacaoOrdem"   Panel.ZIndex="0" TabIndex="19" IsEditable="False" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="132" />

                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.Carteira}" Margin="492,0,0,0" x:Name="labelUpdateCarteira" Padding="0,0,0,0"  HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="40"/>
                            <Controls:SinacorInt32TextBox Value="{Binding Path=Carteira}" LostFocus="textUpdateCarteira_LostFocus" Margin="492,20,0,0"  x:Name="textUpdateCarteira" Panel.ZIndex="0" TabIndex="19" Integers="3" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="40" MaxLength="3" />

                            <Controls:SinacorLabel Content="{DynamicResource Bovespa.Ordens.Label.PercentualReducaoAcrescimo}" Margin="538,0,0,0" x:Name="labelUpdatePercentualReducaoAcrescimo" Padding="0,0,0,0"  HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Width="150"/>
                            <Controls:SinacorDecimalTextBox LostFocus="textUpdatePercentualReducaoAcrescim_LostFocus" AcceptsNegative="True" Value="{Binding Path=PercentualReducaoAcrescimo}" Margin="538,20,0,0"  x:Name="textUpdatePercentualReducaoAcrescim" Panel.ZIndex="0" TabIndex="19" MaxLines="1" Integers="4" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="140" Decimals="8" />

                            <Controls:SinacorButton Content="{DynamicResource Bovespa.Ordens.Label.Salvar}" Margin="685,20,0,0" HorizontalAlignment="Left"  VerticalAlignment="Top" Command="Edit:EditCommands.EndUpdate"  x:Name="btnAlterarOrdem"
								CommandTarget="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}"
								Visibility="{Binding Path=IsEnabled, Converter={StaticResource booleanToVisibilityConverter}, RelativeSource={RelativeSource Self}}" />
                            <Controls:SinacorButton Command="Edit:EditCommands.CancelUpdate" Margin="788,20,0,0" HorizontalAlignment="Left"  VerticalAlignment="Top" Content="X" Width="20" x:Name="btnFecharPopup" CommandTarget="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorDataGrid}}}"
								Visibility="{Binding Path=IsEnabled, Converter={StaticResource booleanToVisibilityConverter}, RelativeSource={RelativeSource Self}}" >
                            </Controls:SinacorButton>
                        </Grid>
                    </DataTemplate>
                </Controls:SinacorDataGrid.PanelUpdateTemplate>
            </Controls:SinacorDataGrid>
        </Controls:SinacorExpander>

        <Controls:SinacorHorizontalGridSplitter x:Name="horizontalSpliter2" Grid.Row="2" Margin="0,3,0,0" Height="2" />

        <Controls:SinacorExpander Header="{DynamicResource Bovespa.Ordens.Label.TituloPreBoleto}" Grid.Row="3" x:Name="exp3" Margin="0,4,0,0" IsExpanded="True" >
            <Controls:SinacorDataGrid x:Name="grdPreBoletos" ApplyingStyle="grdPreBoletos_ApplyingStyle" ItemsSource="{Binding Path=ModelPreBoletoAnalitico}">
                <Controls:SinacorDataGrid.Columns>

                    <Controls:Column Name="QuantidadeNegocio"
						Title="Bovespa.Ordens.Label.QuantidadeNegocio"
						DisplayMemberPath="QuantidadeNegocio" Decimals="4" Integers="16" StringFormat="n4"  HorizontalCellAlignment="Right" />

                    <Controls:Column Name="Preco"
						Title="Bovespa.Ordens.Label.Preco"
						DisplayMemberPath="Preco" Integers="11" Decimals="8" StringFormat="n8"  HorizontalCellAlignment="Right" />

                    <Controls:Column Name="ContraParte"
						Title="Bovespa.Ordens.Label.ContraParte"
						DisplayMemberPath="ContraParte"  HorizontalCellAlignment="Right" />

                    <Controls:Column Name="QuantidadeCasada"
						Title="Bovespa.Ordens.Label.QuantidadeCasada"
						DisplayMemberPath="QuantidadeCasada"  Decimals="4" Integers="16"  StringFormat="n4"  HorizontalCellAlignment="Right"/>

                </Controls:SinacorDataGrid.Columns>
            </Controls:SinacorDataGrid>
        </Controls:SinacorExpander>
    </Controls:SinacorExpanderContainer>
</Controls:SinacorWindow>
